// Blockly.Themes.Halloween = Blockly.Theme.defineTheme('halloween', {
//     'base': Blockly.Themes.Classic,
// });


Blockly.Themes.Halloween = Blockly.Theme.defineTheme('halloween', {
    'base': Blockly.Themes.Classic,
    // 'categoryStyles': {
    //   'list_category': {
    //     'colour': "#4a148c"
    //   },
    //   'logic_category': {
    //     'colour': "#8b4513",
    //   },
    //   'loop_category': {
    //     'colour': "#85E21F",
    //   },
    //   'text_category': {
    //     'colour': "#FE9B13",
    //   },
    // },
    'blockStyles': {
      'list_blocks': {
        'colourPrimary': "#4a148c",
        'colourSecondary':"#AD7BE9",
        'colourTertiary':"#CDB6E9",
      },
      'logic_blocks': {
        'colourPrimary': "#8b4513",
        'colourSecondary':"#ff0000",
        'colourTertiary':"#C5EAFF"
      },
      'loop_blocks': {
        'colourPrimary': "#85E21F",
        'colourSecondary':"#ff0000",
        'colourTertiary':"#C5EAFF"
      },
      'text_blocks': {
        'colourPrimary': "#FE9B13",
        'colourSecondary':"#ff0000",
        'colourTertiary':"#C5EAFF"
      },
    },
    'componentStyles': {
        'workspaceBackgroundColour': '#ff7518',
        'toolboxBackgroundColour': '#F9C10E',
        'toolboxForegroundColour': '#fff',
        'flyoutBackgroundColour': '#b3b3b356',
        'flyoutForegroundColour': '#ccc',
        'flyoutOpacity': 1,
        'scrollbarColour': '#ff0000',
        'insertionMarkerColour': '#fff',
        'insertionMarkerOpacity': 0.3,
        'scrollbarOpacity': 0.4,
        'cursorColour': '#d0d0d0',
        'blackBackground': '#333'
      }
  });

/* TODO: Change toolbox XML ID if necessary. Can export toolbox XML from Workspace Factory. */
let toolbox = document.getElementById("toolbox");

var options = { 
	toolbox : toolbox, 
    theme: Blockly.Themes.Halloween,
	collapse : true, 
	comments : true, 
	disable : true, 
	maxBlocks : Infinity, 
	trashcan : true, 
	horizontalLayout : false, 
	toolboxPosition : 'start', 
	css : true, 
	media : 'static/media', 
	rtl : false, 
	scrollbars : true, 
	sounds : true, 
	oneBasedIndex : true, 
  renderer: 'Zelos', //thrasos,Zelos,Geras
	grid : {
		spacing : 20, 
		length : 1, 
		colour : '#888', 
		snap : false
	}
};

var Code = {};

/* Inject your workspace */ 
var workspace = Blockly.inject('blocklyDiv', options);

/* Load Workspace Blocks from XML to workspace. Remove all code below if no blocks to load */

/* TODO: Change workspace blocks XML ID if necessary. Can export workspace blocks XML from Workspace Factory. */
var workspaceBlocks = document.getElementById("blocklyDiv"); 

// var codeworkspace = Blockly.inject('pythoncode', options);
/* Load blocks to workspace. */
Blockly.Xml.domToWorkspace(workspaceBlocks, workspace);

// Code.renderContent = function () {
// 	// Generate JavaScript code and display it.
// 	javascript.javascriptGenerator.INFINITE_LOOP_TRAP = null;
// 	Code.attemptCodeGeneration(python.pythonGenerator)
// };




// function myUpdateFunction(event) {
// 	var content = document.getElementById('content_python');
// 	content.textContent = '';
// 	code = python.pythonGenerator.workspaceToCode(workspace)
// 	content.textContent = code;
// }

// workspace.addChangeListener(myUpdateFunction);